package com.seesmic
{
	/*
	Copyright 2007 SEESMIC, Inc
	Licensed under the Apache License, Version 2.0 (the "License"); 
	you may not use this file except in compliance with the License. You may obtain a copy of the License at 
	
	http://www.apache.org/licenses/LICENSE-2.0 
	
	Unless required by applicable law or agreed to in writing, 
	software distributed under the License is distributed on an 
	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
	See the License for the specific language governing permissions and limitations under the License.
	*/
	public dynamic class VideoVO
	{
		namespace w3Atom = "http://www.w3.org/2005/Atom"
		use namespace w3Atom;
		
		public var created_at:String	
		public var language:String
		public var source:String 	 
		public var source_server:String	
		public var thread_posts:String	
		public var title:String	
		public var url_flv:String		
		public var url_player:String	
		public var url_thread_start:String		
		public var url_thumbnail:String		
		public var username:String	
		public var video_id:String	
		public var dictionary:Object = new Object();

		public function VideoVO()
			{
			super();
		}
		
		public function parseXML(xml:*):void
		{
			
				 
			this.title = xml.title
			this.created_at = xml.published
			
			//trace("LINK " + xml.entry.link)
			for(var i:* in xml.link)
			{
				var link:* = xml.link[i]
				if(link.@type == "video/x-flv") this.url_flv = link.@href
				else if(link.@type == "image/jpeg") this.url_thumbnail = link.@href;
				
			}
			//videoVO.platform = 
		//	this.infoPopulated = true
			var uri:String = xml.id;
			var platformId:String = 
			uri.split("/video/")[1]
			var platform:String = ""
			if(this.url_flv.indexOf("cache.googlevideo.com") >= 0)
			{
				platform = "http://www.youtube.com"
			}
			//this.platform = platform
			//this.platformId = platformId
			this.username = xml.author.name
			//videoVO.thumbnail = xml.link.(@type == "image/jpeg").@href;
		 this.video_id = xml.id
		/**
		 * <message from="events@jabber.seesmic.com/6588880971207572859485532" id="115643" 
		 * to="anonymous@jabber.seesmic.com" type="chat">
		 * <item xmlns="http://jabber.org/protocol/pubsub">
		 * <entry xmlns="http://www.w3.org/2005/Atom">
		 * <title>Re: test</title>
		 * <link href="http://www.seesmic.com/video/DaOM2cU5hn" />
		 * <id>http://www.seesmic.com/video/DaOM2cU5hn</id>
		 * <author><name>jaymartinez</name></author>
		 * <published>2008-04-14T16:56:11+00:00</published>
		 * <updated>2008-04-14T16:56:11+00:00</updated>
		 * <content>Re: test</content>
		 * <link length="4047" rel="enclosure" title="Re: test"
		 *  href="http://fms3.seesmic.com/thumbnail/Ec1e35PRso_th1.jpg" type="image/jpeg" />
		 * <link length="151985" rel="enclosure"
		 *  title="Re: test" href="http://fms3.seesmic.com/flv/Ec1e35PRso.flv"
		 *  type="video/x-flv" />
		 * <source>
		 * 		<generator>EventBot</generator>
		 * 		<id>http://www.seesmic.com/video/knnyxrbAGW</id>
		 * 		<link rel="related" href="http://www.seesmic.com/video/knnyxrbAGW" />
		 * </source>
		 * <category term="en" />
		 * <category term="public.timeline" /></entry></item>
		 * <body>jaymartinez: Re: test - view at http://www.seesmic.com/video/DaOM2cU5hn :: en public.timeline</body>
		 * </message>
		 * 
		 * 
		 * <message from="events@jabber.seesmic.com/118537221208924649139185" id="39553" to="anonymous@jabber.seesmic.com" type="chat">
		 * <item xmlns="http://jabber.org/protocol/pubsub">
		 * <entry xmlns="http://www.w3.org/2005/Atom">
		 * <title>Partez pendant qu&apos;il en est encore temps !</title>
		 * <link href="http://www.seesmic.com/video/M1y73h7Lkp" />
		 * <id>http://www.seesmic.com/video/M1y73h7Lkp</id>
		 * <author><name>amstramgram</name></author>
		 * <published>2008-04-25T09:29:05+00:00</published>
		 * <updated>2008-04-25T09:29:05+00:00</updated>
		 * <content>Partez pendant qu&apos;il en est encore temps !</content>
		 * <link length="4401" href="http://t.seesmic.com/thumbnail/FTDYEAJLZW_th1.jpg" rel="enclosure" type="image/jpeg" title="Partez pendant qu&apos;il en est encore temps !" />
		 * <link length="9044528" href="http://v.seesmic.com/flv/FTDYEAJLZW.flv" rel="enclosure" type="video/x-flv" title="Partez pendant qu&apos;il en est encore temps !" />
		 * <source><generator>EventBot</generator><id>http://www.seesmic.com/video/M1y73h7Lkp</id></source><category term="en" /><category term="public.timeline" /></entry></item><body>amstramgram: Partez pendant qu&apos;il en est encore temps ! - view at http://www.seesmic.com/video/M1y73h7Lkp :: en public.timeline</body></message>
		 * 
		 * 
		 * */
		}
		
		/**
		 * {"source_server": "http://v.seesmic.com", 
		 * "thread_posts": 14, "title": "test ignore", 
		 * "language": "en", "video_id": "TVl6B8dLuh", 
		 * "username": "sj777", 
		 * "url_flv": "http://v.seesmic.com/flv/QjaTLIdPwK.flv", 
		 * "thread_id": "ObhUMMATqn", 
		 * "reply_to_video_id": "ObhUMMATqn", 
		 * "source": "http://seesmic.com/video/webrecorder", 
		 * "reply_to_username": "loiclemeur", 
		 * "thread_post_count": 14, 
		 * "url_thumbnail": "http://t.seesmic.com/thumbnail/QjaTLIdPwK_th1.jpg", 
		 * "created_at": "2008-04-04T15:05:50.317Z", 
		 * "url_player": "http://www.seesmic.com/video/TVl6B8dLuh"}
		 * */
		public function parse(vo:* ):void
		{
			for(var i:* in vo)
			{
				if(this.hasOwnProperty(i))
				{
					this[i] = vo[i]
				}
				 
			}
		}
		
	//	public function 

	}
}